package com.itcam.recursion;

/**
 * @author : Cammy.Wu
 * Description : 阶乘
 */

public class Demo01Factorial {
    public static void main(String[] args) {
        int n = 7;
        System.out.printf("%s的阶乘为:%s", n, f(n));
    }

    private static int f(int n) {
        if (n == 1) {
            return 1;
        }
        return f(n - 1) * n;
    }
}
